<%@ page language="java" pageEncoding="UTF-8" trimDirectiveWhitespaces="true" %>
 <%@include file="../include/jspheader.jsp" %>
 
 <html>
 
 <style type="text/css">
.unZhankai{
display:none;
}
 

</style>
 <body>
<div id="Mainbody">
  
     <%@include file="../include/top.jsp" %>
     <%@include file="../include/left.jsp" %>
    
   <form action="<%=request.getContextPath()%>/center/wordList.action" method="post" id="searchform">
   
  <div class="right2">
    	<div id="TopNav">
            <a href="<%=request.getContextPath()%>/center/studyList.action">学习列表</a> 
            <a href="<%=request.getContextPath()%>/center/wordList.action" >生词本</a>
            <a href="<%=request.getContextPath()%>/center/collections.action" class="this">收藏单词</a>
    	</div>
    <div class="clear"></div>
      <table border="0" cellspacing="0" cellpadding="0" class="datasheet">
      	<tr>
        <th align="left">词汇</th>
         <th width="19%" align="center">操作</th>
        </tr>
          <s:iterator value="#request.wordList" status="status">
        <tr id="<s:property value="id"/>">
        <td>
        <a href="#" onclick="zhanKaiOrShouLong(<s:property value="id"/>)"><img src="<%=request.getContextPath()%>/images/shoulongsmall.png" id="img_zs_<s:property value="id"/>" />
        </a> <s:property value="spelling"/> 
      <s:property value="phonetics" escape="false" />    &nbsp;
        <a onclick=pronunciation("<s:property value="spelling"/>")><img src="<%=request.getContextPath()%>/images/voice.png" width="14" height="14" /></a>
         </td>
        <td align="center">
       <a   href="#" onclick=releaseCollection("<s:property value="id"/>") class="StartMemory">取消收藏</a>
       </td>
        </tr>
         <tr id="zs_<s:property value="id"/>" class="unZhankai" name="unZhankai">
        <td colspan="2" class="unfoldTd">
        <table border="0" cellspacing="0" cellpadding="0" class="unfold">
         <tr  name="zs">
          <td colspan="4"> 
          <s:property value="meaning"/><br>
          <s:iterator value="sentenceList" id="inner">
          <div><s:property value="#inner.sentence"  escape="false"/></div>
          </s:iterator>
          </td>
        </tr>
        </table>
        </td>
        </tr>
         </s:iterator>
	  </table>
	   <%@include file="../commons/pageNav.jsp" %>
    </div>
    
    	<div class="clear"></div>
     <%@include file="../include/footer.jsp" %>
     
     </form>
</div>
</body>
<script>


function zhanKaiOrShouLong(id){

var  word= document.getElementById("zs_"+id);
if(word.style.display==""||word.style.display=="none"){
   word.style.display="block";
   document.getElementById("img_zs_"+id).src="<%=request.getContextPath()%>/images/zhankaismall.png";
}else{
    word.style.display="none";
    document.getElementById("img_zs_"+id).src="<%=request.getContextPath()%>/images/shoulongsmall.png";

}
var allWord=document.getElementsByName("unZhankai");
for(i=0;i<allWord.length;i++){
if(allWord[i].id!="zs_"+id&&(allWord[i].style.display!="none"||allWord[i].style.display!="")){
  allWord[i].style.display="none";
  document.getElementById("img_"+allWord[i].id).src="<%=request.getContextPath()%>/images/shoulongsmall.png";
  }
}

}

function releaseCollection(wordid){
 
var params = {
				wordid :wordid
			};
	$.ajax( {
			type :"POST",
			dataType :"json",
			url :"releaseCollections.action",
			cache :false,
			data :params,
			//请求成功
			success :function(ajaxResult){
			if(ajaxResult.isSuccess==true){
				 document.getElementById(wordid).style.display="none";
				 }else{
				  alert("取消收藏失败!");
				 }
			},
			clearForm :true
		});
}


 


</script>

</html>